<?php

/**
 * 当前位置
 *
 * @package    01CMS
 * @subpackage plugin
 * @author     rolong at vip.qq.com
 * @version    1.0.0
 * @link       http://www.01cms.com
 */

function smarty_function_categoryInfo ($params)
{
    $Category = model('Category', $params['id']);
    
    if ($Category->type > 0)
    {
        $Category->activeUrl = BOOT_URL . '/category/' . $params['id'];
        $Category->staticUrl = ROOT_DIR . Base::i()->Load->var['htmlSaveDir'] . '/' . $Category->alias;
        switch ($Category->visit)
        {
            case 1:
            {
                $Category->url = $Category->staticUrl;
                break;
            }
            case 2:
            {
                $Category->url = $Category->activeUrl;
                break;
            }
            default:
            {
                $Category->url = defined('staticHtml') ? $Category->staticUrl : $Category->activeUrl;
            }
        }
    }
    else
    {
        $Category->url = $Category->link;
    }
    
    return $Category->$params['field'];
}
